<script type="text/javascript" src="{$base_dir}js/swfobject.js"></script>
<script type="text/javascript" src="{$base_dir}js/json2.js"></script>
<script src="{$base_dir}modules/report/js/AJAX_GeneralReport.js" type="text/javascript"></script>

<script type="text/javascript"><!--
var base_uri = {$base_dir} + "flash/open-flash-chart.swf";
var exportImage = ":)";
{literal}
var params = {wmode: "opaque"};
swfobject.embedSWF(base_uri, "portletLineHollow", "830", "300", "9.0.0", "expressInstall.swf", {"data-file":{/literal}"{$lineHollowUrl}"{literal}, "loading":"Đang vẽ biểu đồ..."}, params);

OFC = {};
 
OFC.jquery = {
    name: "jQuery",
    version: function(src) { return $('#'+ src)[0].get_version() },
    rasterize: function (src, dst) { $('#'+ dst).replaceWith(OFC.jquery.image(src)) },
    image: function(src) { return "<img src='data:image/png;base64," + $('#'+src)[0].get_img_binary() + "' />"},
    popup: function(src) {
        var img_win = window.open('', 'Charts: Export as Image')
        with(img_win.document) {
            write('<html><head><title>Charts: Export as Image<\/title><\/head><body>' + OFC.jquery.image(src) + '<\/body><\/html>') }
     }
}

if (typeof(Control == "undefined")) {var Control = {OFC: OFC.jquery}}

function save_image() { OFC.jquery.popup(exportImage) }

function set_export_flash(flashId) {
	exportImage = flashId;
}
{/literal}
-->
{literal}
	$(document).ready(function(){
	    activeMenu('2', '98');   
		$('table#tblViewReportData tr:even').addClass('alt');
	});
{/literal}
</script>
<!-- Global buttons -->
{include file='general_report/element_global_button.html'}
<div class="separator"></div>
<div class="separator"></div>
<div id="gReportContent">
	<div onmouseover="set_export_flash('portletLineHollow');">
		<div id="portletLineHollow"></div>
	</div>
	
	<div class="separator"></div>
	
	<div>
	   <a href="javascript:showTableView()" id="showTableView" class="contentLink">
	   		<img src="{$base_uri}/images/arrow_circle.png" border='0' align='top'/>
	   		<span>{translate}View data table{/translate}</span>
	   </a>
	   <div class="separator"></div>
	   <div id="tableViewDiv" style="display: none;">
		   <table id="tblViewReportData" class="grid" cellpadding="0" cellspacing="0">
	            <thead>
	                <tr>
	                    <th class="first" style="width: 60px;">{translate}Order{/translate}</th>
	                    <th style="width: 120px;">{if $report->getMetricName() <> ''}{$report->getMetricName()}{else}{translate}Variable{/translate}{/if}</th>
	                    <th class="last" style="width: 120px;">{if $report->getDataName() <> ''}{$report->getDataName()}<br/>{$unit}{else}{translate}Data{/translate}{/if}</th>
	                </tr>
	            </thead>
	            <tbody>
	            {if isset($data)}
	                {foreach from=$data item=item}
	                    <tr>
	                        <td class="first">{$item.order}</td><td>{$item.metric_value}</td>
	                        <td class="last">{$item.data_value}</td>
	                    </tr>
	                {/foreach} 
	            {else}
	                <tr><td colspan="3" class="first last">{translate}Report hasn't had data yet{/translate}</td></tr>
	            {/if}
	            </tbody>
            </table>
        </div>
	</div>
	
	<div class="separator"></div>
	<div class="separator"></div>
	
	<div style="display: block;">
			<input type="button" value="&lt;&lt; {translate}Input data{/translate}" id="btnInputData" onclick="inputData({$report->get_id()})" title="{translate}Input data into report{/translate}">
			&nbsp;<input type="button" value="{translate}Edit report{/translate}" id="btnEditReport" onclick="editReport({$report->get_id()})" title="{translate}Edit report{/translate}">
	</div>
</div>

